<template>
  <div>
    <h1>添加用户信息</h1>
    用户名:<input type="text" id="userAccount"><br>
    密码:<input type="text" id="userPwd"><br>
    确认密码:<input type="text" id="userPwd2"><br>
    真实姓名：<input type="text" id="userName"><br>
    用户等级:<select name = "level" id ="level"><br>
        <option value="所有用户" selected>所有用户</option>
        <option value="超级管理员">超级管理员</option>
        <option value="灾情管理员">灾情管理员</option>
        <option value="专家管理员">专家管理员</option>
        <option value="库房管理员">库房管理员</option>
    </select><br>
    <input type="button" value="添加" @click="getUserList()">
  </div>
</template>

<script>
export default {
    data(){
    return{
        userAccount:"",
        userPwd:"",
        userPwd2:"",
        level:"",
        userName:"",
    }
  },
    methods:{
    async getUserList(pageNO){
    var value=document.getElementById("level")
    var index=value.selectedIndex;
    var val=value.options[index].value;
    this.level= val
    
    var userAccount=document.getElementById("userAccount").value;
    this.userAccount=userAccount

    var userPwd=document.getElementById("userPwd").value;
    this.userPwd=userPwd

    var userName=document.getElementById("userName").value;
    this.userName=userName

    let paramObj={userAccount:this.userAccount,userPwd:this.userPwd,userLevel:this.level,userName:this.userName}
    let cutObj = await this.ajax.getSubmit("/api/users/addUser",paramObj)

    this.$router.push("/User")
  }
 }
}
</script>

<style>

</style>